{__NOLAYOUT__}
<html><head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>用户中心</title>
    <meta name="Keywords" content="">
    <meta name="Description" content="">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/agent/css/public.css" />
    <link rel="stylesheet" href="/agent/css/user.css" />
    <script type="text/javascript" src="/agent/js/layer.js" ></script>
    <link rel="stylesheet" href="/agent/css/layer.css" />
    <script type="text/javascript" src="/agent/js/jquery.js" ></script>
    <script type="text/javascript" src="/agent/js/rem.js" ></script>
    <script type="text/javascript" src="/agent/js/mobileSelect.js"></script>
    <link rel="stylesheet" type="text/css" href="/agent/css/mobileSelect.css" />
</head>
<body class="body_tj">
<div id="tbh5v0">
    <div class="addressmone">
        <form action="/agent/agent/addAddress" method="post" name="theForm" id="theForm" >
            <ul>
                <li>
                    <span>收 货 人</span> <em><input type="text" name="row[name]" value="" id="consignee_" placeholder="收 货 人"></em>
                </li>

                <li>
                    <span>所在地区</span>
                    <div id="trigger4" class="trigger4" style="text-indent:0.5em;display: inline-block;color: #333;font-size: 14px;height: 35px;line-height: 35px;border: 1px solid #ccc;width: 73%;margin-left: 0.2rem;">
                        <span style="color: #999;">请选择</span>
                    </div>
                    <input type="hidden" name="row[province]" id="sheng" value="" />
                    <input type="hidden" name="row[city]" id="shi" value="" />
                    <input type="hidden" name="row[area]" id="xian" value="" />
                </li>
                <li>
                    <span>详细地址</span><em> <input type="text" name="row[address]" value="" id="address_" placeholder="详细地址"></em>
                </li>
                <li>
                    <span>联系方式</span> <em><input type="number" name="row[tel]" value="" id="mobile_" placeholder="手机（必填）"></em>
                </li>
                <li>
                    <span>邮政编码</span> <em><input type="number" name="row[code]" value="" id="zipcode_" placeholder="邮政编码"></em>
                </li>
                <li class="custom-checkbox">
                    <span>默认地址</span>
                    <input type="radio" name="row[status]" checked value="1" />
                    <label>是</label>
                    <input type="radio" name="row[status]" value="0" style="margin-left: 0.3rem;" />
                    <label>否</label>
                </li>
            </ul>
            <div class="dotm_btn">
                <input type="submit" value="保存" class="dotm_btn1">
            </div>

        </form>
    </div>
</div>

<script>
  $(function(){
    var mobileSelect4 = new MobileSelect({
      trigger: '#trigger4',
      title: '地区选择',
      wheels: [{data:[
          {
            id:'1',
            value:'',
            childs:[
              {id:'A1',value:''},
            ]
          }
        ]}],
      transitionEnd:function(indexArr, data){

      },
      callback:function(indexArr, data){
        console.log(data);
        $('#sheng').val(data[0].id);
        $('#shi').val(data[1].id);
        $('#xian').val(data[2].id);
      }
    });
    $.ajax({
      type: "get",
      url: "/api/ajax/area",
      dataType: "json",
      success: function(res){
        mobileSelect4.updateWheels(res.data);
      }
    });
    $('.dotm_btn1').click(function(){
      var name = $('#consignee_').val();
      var address = $('#address_').val();
      var tel = $('#mobile_').val();
      var zipcode_ = $('#zipcode_').val();
      var sheng = $('#sheng').val();
      var shi = $('#shi').val();
      var xian = $('#xian').val();
      console.log(xian);
      if(name == ""||name == null){
        layer.open({
          content: '请填写收货人',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      if(address == ""||address == null){
        layer.open({
          content: '地址不能为空',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      if(!(/^1[3456789]\d{9}$/.test(tel))) {
        layer.open({
          content: '请输入正确的手机号码',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      if(zipcode_ == ""||zipcode_ == null){
        layer.open({
          content: '邮政编码不能为空',
          skin: 'msg',
          time: 2 //2秒后自动关闭
        });
        return false;
      }
      $('#theForm').submit();
    });
  });
</script>
</body>

</html>